<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
<div id='app1'>
    <button @click="count += 1">点击增加1</button>
    <p>这个按钮被点击了{{count}}次</p>
</div>

<div id="app2">
    <button @click="greet">greet</button>
</div>

<div id="app3">
    <button @click="say('hi')">hi</button>
    <button @click="say('what\'s the fuck')">what</button>
</div>

<div id="app4">
    <input type="text" @keyup="show($event)">
</div>

<script>
    var app1 = new Vue({
        el: '#app1',
        data: {
            count: 0
        }
    })

    var app2 = new Vue({
        el: "#app2",
        data: {
            name: 'vue.js'
        },
        methods: {
            greet: function (event) {
                alert("hello " + this.name)
                if(event){
                    alert(event.target.tagName)
                }
            }
        }
    })

    var app3 = new Vue({
        el: '#app3',
        methods: {
            say: function(msg){
                alert(msg)
            }
        }
    })

    var app4 = new Vue({
        el: '#app4',
        methods: {
            show: function (ev) {
                if(ev.keyCode==13){
                    alert('你按了回车键！')
                }
            }

        }
    })
</script>
</body>
</html>